<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>background-image + 伪元素 参考链接:https://codepen.io/Chokcoco/pen/abzxjME</title>
    <!-- border-image:https://developer.mozilla.org/zh-CN/docs/Web/CSS/border-image -->
</head>
<link rel="stylesheet" href="../../common.css">
<style>
    :root {
        --bg: #222;
    }

    .border-image {
        width: 200px;
        height: 100px;
        border: 10px solid;
        border-image-source: linear-gradient(45deg, gold, deeppink);
        border-image-slice: 1;
        border-image-repeat: stretch;
        /* border-image-repeat：[ stretch | repeat | round | space ]{1,2} * stretch：将被分割的图像使用拉伸的方式来填充满边框区域；/
        border-radius: 10px;
        /* 圆角无效果 */
    }

    .pesudo {
        position: relative;
        width: 200px;
        height: 100px;
        margin: auto;
    }

    .pesudo::after {
        content: "";
        position: absolute;
        width: 180px;
        height: 80px;
        background: var(--bg);
        top: 50%;
        left: 50%;
        transform: translate(50px, -50%);
        z-index: 3;
        -webkit-animation: move 4s infinite;
        animation: move 4s infinite;
    }

    .pesudo::before {
        content: "";
        position: absolute;
        width: 200px;
        height: 100px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border-radius: 10px;
        background: linear-gradient(45deg, gold, deeppink);
        z-index: 2;
    }

    @-webkit-keyframes move {
        0% {
            transform: translate(50px, -50%);
        }

        50%,
        100% {
            transform: translate(-50%, -50%);
        }
    }

    @keyframes move {
        0% {
            transform: translate(50px, -50%);
        }

        50%,
        100% {
            transform: translate(-50%, -50%);
        }
    }
</style>

<body>
    <section>
        <div class="border-image" style="margin-bottom:40px"></div>
        <div class="pesudo"></div>
    </section>

</body>

</html>